package com.zlz.server.utils;

import org.apache.commons.lang3.StringUtils;

/**
 * @author: zlz
 * @date: 2021/1/29 21:38
 * @description: 参数工具类
 * @since: JDK1.8
 */
public class ParamUtil {
    /**
     * 对模糊查询的特殊字符进行转义
     *
     * @param str 待转义的字符串
     * @return 转义后的字符串
     */
    public static String dealSpecialString(String str) {
        return StringUtils.replaceEach(str, new String[]{"\\", "_", "%"}, new String[]{"\\\\", "\\_", "\\%"});
    }
}
